<?php
/////////////////////////////////////////////////////////////////////////////
// 
//
// workflow_system
//
// workflow_copyright
// 
/////////////////////////////////////////////////////////////////////////////

/**
 * FILE_NAME : pay_accounts.class.php   FILE_PATH : \\classes\application\pay_accounts.class.php
 * ....关于商城支付方式
 *
 * @copyright workflow_system
 * @author workflow Develop Team 
 * @package
 * @subpackage
 * @version Tue Jun 29 15:02:45 CST 2008
 */

class payAccountsClass extends FrameWork {
	/**
	 * 保存商城支付方式
	 * 
	 * @param array $input
	 * @return bool
	 */
	function insertPayMode($input){
		return $GLOBALS['db']->InsertRow($input, 'pay_accounts', 'pay_id');
	}
	
	/**
	 * 支付方式帐号列表
	 * @author  
	 * @param  
	 * @return bool
	 */
	function listLinePayMode($condition,&$obj_page){
		$conditionstr = $this->_conditionSearch($condition);
		$link_array   = $GLOBALS['db']->GetList($conditionstr, $obj_page, "pay_accounts");
		return $link_array;
	}
	
	/**
	 * 构造检索条件
	 * @author     
	 * @param  
	 * @return string
	 */
	function _conditionSearch($condition){
		$condition_str = "";
		if ($condition['pay_id'] != '')
		{
			$condition_str .= " and pay_accounts.pay_id = '" . $condition['pay_id'] . "'";
		}
		if ($condition['pay_name'] != '')
		{
			$condition_str .= " and pay_accounts.pay_name = '" . $condition['pay_name'] . "'";
		}
		if ($condition['pay_ico'] != '')
		{
			$condition_str .= " and pay_accounts.pay_ico = '" . $condition['pay_ico'] . "'";
		}
		if ($condition['pay_account'] != '')
		{
			$condition_str .= " and pay_accounts.pay_account = '" . $condition['pay_account'] . "'";
		}
		if ($condition['pay_type'] != '')
		{
			$condition_str .= " and pay_accounts.pay_type = '" . $condition['pay_type'] . "'";
		}
		return $condition_str;
	}
	
	/**
	 * 删除所选线下支付方式
	 *  
	 */
	function delLinePayMode($id){
		if (intval($id) > 0){
			return $GLOBALS['db']->DelRow(intval($id),'pay_accounts','pay_id');
		}else {
			return false;
		}
	}
	
	/**
	 * 获取指定付费方式 id
	 * @author     
	 * @param  
	 * @return array
	 */
	function getOneLinePay($id){
		if (intval($id) > 0) {
			return $GLOBALS['db']->GetOneRow($id,'pay_accounts','pay_id');
		}
		return false;
	}
	
	/**
	 * 更新线下支付方式
	 * @author
	 * @return bool
	 */
	function updataPayModeInfo($input){
		if ($GLOBALS['db']->UpdateRow($input['pay_id'],$input,'pay_accounts','pay_id')){
			unset($input);
			return true;
		}
		else {
			unset($input);
			return false;
		}
	}
}
?>